package com.tiza.xiaoyoubao.ui.fragment;

import android.view.View;
import android.widget.TextView;

import com.tianze.library.base.BaseFragment;
import com.tiza.xiaoyoubao.R;
import com.tiza.xiaoyoubao.app.Constants;
import com.tiza.xiaoyoubao.entity.EditInfo;

import org.simple.eventbus.EventBus;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by mapple on 17/4/4.
 */

public class CredibilityFragment extends BaseFragment {

    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.tv2)
    TextView tv2;
    @BindView(R.id.tv3)
    TextView tv3;
    @BindView(R.id.tv4)
    TextView tv4;
    @BindView(R.id.tv5)
    TextView tv5;
    @BindView(R.id.tv6)
    TextView tv6;
    private String cerdibility;

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_choose_credibility;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {

    }

    @OnClick({R.id.view1, R.id.view2, R.id.view3, R.id.view4, R.id.view5, R.id.view6})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.view1:
                cerdibility = tv1.getText().toString().trim();
                EventBus.getDefault().post(new EditInfo(EditInfo.TYPE_TAOBAO_CREDIBILITY, cerdibility),
                                           Constants.TAG_SET_TAOBAO_SUCCESS
                );
                finish();
                break;
            case R.id.view2:
                cerdibility = tv2.getText().toString().trim();
                EventBus.getDefault().post(new EditInfo(EditInfo.TYPE_TAOBAO_CREDIBILITY, cerdibility),
                                           Constants.TAG_SET_TAOBAO_SUCCESS
                );
                finish();
                break;
            case R.id.view3:
                cerdibility = tv3.getText().toString().trim();
                EventBus.getDefault().post(new EditInfo(EditInfo.TYPE_TAOBAO_CREDIBILITY, cerdibility),
                                           Constants.TAG_SET_TAOBAO_SUCCESS
                );
                finish();
                break;
            case R.id.view4:
                cerdibility = tv4.getText().toString().trim();
                EventBus.getDefault().post(new EditInfo(EditInfo.TYPE_TAOBAO_CREDIBILITY, cerdibility),
                                           Constants.TAG_SET_TAOBAO_SUCCESS
                );
                finish();
                break;
            case R.id.view5:
                cerdibility = tv5.getText().toString().trim();
                EventBus.getDefault().post(new EditInfo(EditInfo.TYPE_TAOBAO_CREDIBILITY, cerdibility),
                                           Constants.TAG_SET_TAOBAO_SUCCESS
                );
                finish();
                break;
            case R.id.view6:
                cerdibility = tv6.getText().toString().trim();
                EventBus.getDefault().post(new EditInfo(EditInfo.TYPE_TAOBAO_CREDIBILITY, cerdibility),
                                           Constants.TAG_SET_TAOBAO_SUCCESS
                );
                finish();
                break;
            default:
                break;
        }
    }
}
